package main

import "fmt"

// 申明全局变量
var gA int = 100
var gB = 200

// :=  只能够用在函数体内部声明
// gC := 200

func main() {
	// method 12.9
	var a int
	fmt.Println("a= ", a)
	fmt.Printf("type of a = %T\n", a)

	// method 2
	var b int = 100
	fmt.Println("b = ", b)
	fmt.Printf("type of b = %T\n", b)

	var bb string = "abce"
	fmt.Println("bb = ", bb)
	fmt.Printf("type of bb = %T\n", bb)

	// method 3
	var c = 300
	fmt.Println("c = ", c)
	fmt.Printf("type of c = %T\n", c)

	var cc = "alen"
	fmt.Println("cc = ", cc)
	fmt.Printf("type of cc = %T\n", cc)

	// method 4
	d := 242
	fmt.Println("d = ", d)
	fmt.Printf("type of d = %T\n", d)

	f := "ladskfjadfk"
	fmt.Println("f = ", f)
	fmt.Printf("type of f = %T\n", f)

	g := 3.14
	fmt.Println("g = ", g)
	fmt.Printf("type of g = %T\n", g)

	// ====
	fmt.Println("gA = ", gA, ", gB = ", gB)
	// fmt.Println("gC = ", gC)

	// 声明多个变量
	var xx, yy int = 100, 200
	fmt.Println("xx = ", xx, ", yy = ", yy)
	var kk, ll = 300, "alice"
	fmt.Println("kk = ", kk, ", ll = ", ll)

	// 多行的多变量声明
	var (
		vv int  = 100
		jj bool = true
	)
	fmt.Println("vv = ", vv, ", jj = ", jj)

}
